Skip to content

Playground chat tab: vscode.lm, scanner, bundler, fixture replay#22

Merged
jpr5 merged 4 commits into
mainfrom
feat/playground-chat
May 5, 2026
Merged

Playground chat tab: vscode.lm, scanner, bundler, fixture replay#22
jpr5 merged 4 commits into
mainfrom
feat/playground-chat

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented May 4, 2026

Summary

Migrated from CopilotKit/CopilotKit#4635 (by @AlemTuzlak) to the standalone repo.

  • Replaces the OpenAI/Anthropic + API-key + Node-subprocess flow with VSCode's built-in Language Model API (vscode.lm), with optional vscode.lm.tools forwarding so the model can use Copilot's web-fetch tool out of the box
  • Adds a playground scanner that detects <CopilotKit> JSX nodes, serializes props, walks ancestors, maps hooks to components, and orchestrates multi-file scanning
  • Codegen modules (aggregator, entry, error-boundary, provider-chain templates) and rolldown bundler with Tailwind v4 compile pass + file watcher for hot-reload
  • Custom PlaygroundChat that drives the runtime over SSE, executes frontend tool handlers locally, supports followUp: false, renders markdown, and animates fixture replay
  • Fixture store for .copilotkit/fixtures with v2 schema (RecordedCall[]) and replay mode
  • Resizable/collapsible panels: MountedComponents, ConversationSidebar, DiagnosticsPanel, ModelPicker, ScannerView (state persisted to localStorage)
  • Test-workspace rebuilt as a v2-only weather demo with useFrontendTool and deterministic mock-data handlers

Test plan

  • vitest run passes locally (300 tests)
  • Build produces clean dist
  • Open dev host on test-workspace, open Chat tab, ask "what's the weather in Sarajevo?" — renders populated WeatherCard

AlemTuzlak
AlemTuzlak previously approved these changes May 4, 2026
Copy link
Copy Markdown
Contributor

@AlemTuzlak AlemTuzlak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left commentd that need to be addressed, agent go go

Comment thread README.md
## Links

- Website — https://copilotkit.ai
- GitHub — https://github.com/CopilotKit/vscode-extension
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong

Comment thread README.md Outdated
## Feedback

Bugs and feature requests → https://github.com/CopilotKit/vscode-extension/issues
Bugs and feature requests → https://github.com/CopilotKit/CopilotKit/issues
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment thread RELEASING.md Outdated
Cutting a release is one file edit, one commit, one PR.

1. Prepend an entry to `CHANGELOG.md`:
1. Prepend an entry to `packages/vscode-extension/CHANGELOG.md`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong

Comment thread package.json Outdated
"react"
],
"homepage": "https://vscode.copilotkit.dev",
"homepage": "https://copilotkit.ai",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also serms wrong?

Comment thread test-workspace/package.json Outdated
"private": true,
"dependencies": {
"@copilotkit/a2ui-renderer": "^1.56.4",
"@copilotkit/a2ui-renderer": "workspace:*",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong

Comment thread tsdown.config.ts Outdated
// Resolve workspace packages to their TypeScript source instead of compiled
// dist. This avoids CJS-to-ESM interop bugs in Rolldown (e.g., variable
// shadowing in __commonJSMin wrappers that cause TDZ errors).
const workspaceSourceAliases: Record<string, string> = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This id not needed i believe, ask an agent

Comment thread tsdown.config.ts Outdated
// CSS collector — the user's workspace `node_modules` may not
// resolve the bare specifier from the codegen entry's directory.
copyCssAsset(
path.resolve(import.meta.dirname, "../react-core/dist/v2/index.css"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be wrong

Comment thread RELEASING.md Outdated
Use Keep-a-Changelog subsections: `Added`, `Changed`, `Fixed`, `Removed`, `Deprecated`, `Security`. The date is whatever date you commit.

If you also want to change how the extension is described on the Marketplace / Open VSX listing page, edit the first paragraph under the `# CopilotKit for VS Code` title in `README.md` in the same PR. The metadata-sync workflow extracts that paragraph, strips inline markdown, and writes it to `package.json.description` (the field both registries render as the one-liner). First paragraph must stay ≤200 chars — the workflow fails fast otherwise so you don't silently ship a truncated listing.
If you also want to change how the extension is described on the Marketplace / Open VSX listing page, edit the first paragraph under the `# CopilotKit for VS Code` title in `packages/vscode-extension/README.md` in the same PR. The metadata-sync workflow extracts that paragraph, strips inline markdown, and writes it to `package.json.description` (the field both registries render as the one-liner). First paragraph must stay ≤200 chars — the workflow fails fast otherwise so you don't silently ship a truncated listing.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packages/vscode-extension doesn't exist, every reference to it is wrong

Comment thread RELEASING.md Outdated

1. **SP not added as Contributor on the Marketplace publisher.** `copilotkit-vscode-publish` must be a member of the `copilotkit` publisher at <https://marketplace.visualstudio.com/manage/publishers/copilotkit> with the Contributor (or higher) role.
2. **Federated credential subject mismatch.** The credential on the Entra app must have subject **exactly** `repo:CopilotKit/vscode-extension:environment:production` (case-sensitive, no trailing slash). The workflow's `environment: production` must match that subject byte-for-byte.
2. **Federated credential subject mismatch.** The credential on the Entra app must have subject **exactly** `repo:CopilotKit/CopilotKit:environment:production` (case-sensitive, no trailing slash). The workflow's `environment: production` must match that subject byte-for-byte.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repo is CopilotKit/vscode-extension

Comment thread RELEASING.md Outdated

- **ADO PAT retirement (2026-12-01):** Azure DevOps is sunsetting long-lived Marketplace PATs. This workflow has been migrated to OIDC / federated credentials ahead of that date; `VSCE_PAT` is retained only as a short-lived rollback lever (see above).
- **If a release needs to pin to a specific `@copilotkit/*` version**, bump the dependency in `package.json` as part of the same PR that updates the CHANGELOG.
- **If the npm monorepo release pipeline ever needs to coordinate with VSIX releases** (e.g. pin the extension to a known-good `@copilotkit/*` version), extend `release.config.json` with a `vscode-extension` scope and gate it on the same version-on-main trigger — do not try to bolt VSIX publishing onto `scripts/release/publish-release.ts` which is npm-only.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert, this wqs moved out of tge monorepo

Comment thread package.json Outdated
},
"dependencies": {
"@ag-ui/client": "0.0.52",
"@copilotkit/runtime": "workspace:*",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All workspace:* are wrong they have to be pinned to,the latest version properly

@jpr5 jpr5 force-pushed the feat/playground-chat branch from 4e074ec to a3371e3 Compare May 4, 2026 21:24
AlemTuzlak
AlemTuzlak previously approved these changes May 4, 2026
@jpr5 jpr5 force-pushed the feat/playground-chat branch 10 times, most recently from cd1cd5a to 025a282 Compare May 4, 2026 23:56
AlemTuzlak added 3 commits May 4, 2026 16:59
Scanner detects <CopilotKit> JSX nodes, serializes props, maps hooks
to components (including anonymous default exports). Codegen emits
aggregator, entry, error-boundary, provider-chain templates with
shared import-specifier utility. Recursive renderValue handles nested
UnserializableRef in provider props. Rolldown bundler with Tailwind v4
compile and file watcher for hot-reload.

vscode.lm factory with live/record/replay modes, model picker, runtime
host with SSE, fixture store with path traversal protection, version
validation, name collision avoidance. Fixture replay supports both
TEXT_MESSAGE_CONTENT and TEXT_MESSAGE_CHUNK AG-UI event types.

SSE error handling uses sentinel error name for RUN_ERROR events.
Scanner caches file contents. View provider posts user-visible errors
on missing provider or failed codegen, resets replay state on dispose,
clears stale bundle on model switch.
Custom PlaygroundChat drives the runtime over SSE, executes frontend
tool handlers locally, renders markdown, animates fixture replay.
Resizable/collapsible panels with localStorage persistence. Bundle
loader with CSP nonce bootstrap, forwarding stubs for v2 provider.
Error message handler for extension host errors.
Replace fixture components with playground app structure using
useFrontendTool with deterministic mock-data handlers. v1/v2 example
components, CurrentWeatherTool, Tailwind globals. Type-compatible
with published @copilotkit/* packages.
@jpr5 jpr5 force-pushed the feat/playground-chat branch from 025a282 to a7435e7 Compare May 4, 2026 23:59
Pin @copilotkit/* to ^1.56.5, inline base tsconfig, use builtinModules
for NODE_BUILTINS, stubNodeBuiltinsAndCss on all browser webview
entries. Gitignore node_modules/dist/vsix/tsbuildinfo. Vitest setup
for localStorage polyfill and @CopilotKit CSS inline deps. Add
LanguageModelToolResultPart to test mocks, fix disconnected
AbortController in test fixtures.

Bump version to 0.2.0. CHANGELOG documents Playground feature and
hardening fixes. Add [Unreleased] convention to CHANGELOG and
RELEASING.md. Publish workflow strips [Unreleased] section before
packaging VSIX so unreleased work never appears on the Marketplace.
README documents Playground panel, fixes engine version to 1.90.0.
Update all URLs, paths, OIDC subjects for standalone repo.
@jpr5 jpr5 force-pushed the feat/playground-chat branch from a7435e7 to 76361be Compare May 5, 2026 00:00
@jpr5 jpr5 merged commit c374449 into main May 5, 2026
2 checks passed
@jpr5 jpr5 deleted the feat/playground-chat branch May 5, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants